import $util from "@/utils/index.js"
import $api from "@/api/index.js"
import {
	req
} from '@/utils/req.js';
export default {
	state: {
		pageActive: false,
		activeIndex: 0,
		tabList: [{
			title: '推荐',
			id: 0
		}, {
			title: '动态',
			id: 1,
			// number: 10
		}, {
			title: '话题',
			id: 2
		}],
		param: {
			p: 1,
		},
		list: {
			data: [],
			last_page: 1,
			current_page: 1
		},
		haveOperItem: false
	},
	mutations: {
		async updateAssocrecomItem(state, item) {
			let {
				key,
				val
			} = item
			state[key] = val
		}
	},
	actions: {
		async getAssocrecom({
			commit,
			state
		}, param) {
			let d = await $api.service.getAssocrecom(param)
			let oldList = state.list
			let newList = d
			let list = {}
			if (param.p == 1) {
				list = newList
			} else {
				newList.data = oldList.data.concat(newList.data)
				list = newList
			}
			commit('updateAssocrecomItem', {
				key: 'list',
				val: list
			})
		}
	}
}
